<h3><?php echo $this->title?></h3>
<div class="upload-image">
<div style="color:red;" id="edit_message"><?php echo $this->errMessage;?></div>
<form action="/admin/article/list" method="get">
    <h4>Tìm kiếm tin tức</h4>
    <table class="table table-condensed">
        <tr>
            <td><label for="id">Id:</label></td>
            <td><input type="text" id="id" name="id" value="<?php echo $this->params['id'];?>" /></td>
        </tr>
        
        <tr>
            <td><label for="title">Tiêu đề:</label></td>
            <td><input id="title" name="title" value="<?php echo $this->params['title'];?>" /></td>
        </tr>
    </table>
    <div class="control-group">
        <div class="controls">
          <button type="submit" class="btn">Tìm</button>
        </div>
  </div>
</form>
<a href="/admin/article/edit" style="font-weight: bold">Thêm mới</a>
<?php if(is_array($this->articles)) {?>
    <table class="table table-bordered table-striped">
        <thead>
              <tr>
                <th>Tiêu đề</th>
                <th>Hình đại diện</th>
                <th><a href="<?php echo $this->currentUrl?>&sort_by=category&sort_dir=<?php echo $this->sortDir^1?>">Phân mục<?php if($this->sortBycategory) {?><i class="<?php echo $this->clzzSort?>"></i><?php }?></a></th>
                <th><a href="<?php echo $this->currentUrl?>&sort_by=order&sort_dir=<?php echo $this->sortDir^1?>">Order<?php if($this->sortByorder) {?><i class="<?php echo $this->clzzSort?>"></i><?php }?></a></th>
                <th>Hiện trên web</th>
                <th>Người tạo</th>
                <th><a href="<?php echo $this->currentUrl?>&sort_by=last_update&sort_dir=<?php echo $this->sortDir^1?>">Ngày cập nhật<?php if($this->sortBylast_update) {?><i class="<?php echo $this->clzzSort?>"></i><?php }?></a></th>
                <th><a href="<?php echo $this->currentUrl?>&sort_by=dateline&sort_dir=<?php echo $this->sortDir^1?>">Ngày tạo<?php if($this->sortBydateline) {?><i class="<?php echo $this->clzzSort?>"></i><?php }?></a></th>
                <th>Thao tác</th>
              </tr>
        </thead>
        <tbody>
            <?php foreach($this->articles as $article) : ?>
             <tr>
                 <td><?php echo $article['titles']['vi']['content']?></td>
                 <td>
                     <?php if($article['image']) {?>
                     <a class="fancy" href="<?php echo Utils_Global::get('staticUrl') . '/article/' . $article['hash_folder'] . '/' . $article['image']?>">
                         <img alt="<?php echo $article['image']?>" src="<?php echo Utils_Global::get('staticUrl') . '/article/' . $article['hash_folder'] . '/' . $article['image']?>?>" width="70" height="54">
                     </a>
                     <?php }?>
                 </td>
                 <!-- td style="width: 30%"><?php echo $article['short_description']?></td-->
                 <td style="width: 20%"><?php echo $article['category_name']?></td>
                 <td><?php echo $article['order']?></td>
                 <td style="width: 8%">
                     <?php if($article['active']) {?>
                     <i class="icon-ok"></i>
                     <?php } else {?>
                     <i class="icon-lock"></i>
                     <?php }?>
                 </td>
                 <td><?php echo $article['editor']?></td>
                 <td><?php echo date('d/m/Y', $article['last_update'])?></td>
                 <td><?php echo date('d/m/Y', $article['dateline'])?></td>
                 <td>
                     <a href="/admin/article/edit/id/<?php echo $article['id']?>">
                         <i class="icon-edit"></i>
                     </a>
                     <a href="/admin/article/delete/id/<?php echo $article['id']?>" onclick="return confirm('sure?');">
                         <i class="icon-remove"></i>
                     </a>
                 </td>
             </tr>
             <?php endforeach;?>
        </tbody>
      </table>
      <?php echo $this->paginationcontrol2($this->page, $this->totalItem, $this->numRowPerPage, 'pagination.phtml', $this->currentUrl);?>
</div>
<?php } else {?>
<div>Không có tin tức nào!</div>
<?php }?>
